<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/struct_info.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/infopad.js?2.2"></script>
<script src="${staticServer}/inc/js/datepicker.js"></script>
<script type="text/javascript" src="${staticServer}/common/uploadify/jquery.uploadify.js"></script>
<script type="text/javascript" src="${staticServer}/js/web/uploadImg.js?1.5"></script>

<style>
#SWFUpload_0{
	margin-top: 70px;
    margin-left: -30px;
}
#SWFUpload_1{
	margin-top: 70px;
    margin-left: -30px;
}
.SEARCH_hide h3 {
    overflow: hidden;
    height: 8px;
    line-height: 16px;
    color: #a6a6a6;
    font-weight: 400;
    font-size: 14px;
    padding: 8px 15px 10px 15px;
}
.SEARCH_hide {
    position: absolute;
    width: 238px;
    box-shadow: 0 2px 2px #e5e5e5;
    background-color: #fff;
    border: 1px solid #e5e5e5;
    z-index: 99;
}
.SEARCH_hideL {
    float: left;
    width: 238px;
    height: 400px;
    overflow: hidden;
    border-right: 1px solid #e5e5e5;
}
</style>
<script>
var contextPath='${contextPath}';
var _contextPath = '${staticServer}';

$(function(){
	$("#student").keyup(function(){
		var student = $("#student").val();
		$("#stu_id").val("");
		if(student!=null && student!=""){
			$.post("${contextPath}/index/getStudentByName.json", {
				"nickname":student
			}, function(ms) {
				var list = ms.list;
				var objHtml = '';
				for(var i=0;i<list.length;i++){
					objHtml +='<h3 onmouseover="getHtml('+list[i].id+',\''+list[i].nickname+'\')"><span class="historys">'+list[i].nickname+list[i].phone+'</span></h3>';
				}
				
				$("#SearchHide1").html('<div class="SEARCH_hideL">'+objHtml+'</div>');
				$("#SearchHide1").show();
			});
		}
	});
	
	$(document).click(function(){
		$("#SearchHide1").hide();
    
	});
	$("#state").val("<#if tuf??><#if tuf.state=="未审核">0<#elseif tuf.state=="待提交">1<#elseif tuf.state=="待整理">2<#elseif tuf.state=="待调查">"3"<#elseif tuf.state=="待审核">4<#elseif tuf.state=="待打款">5<#elseif tuf.state=="已退款">6<#else>${tuf.state}</#if></#if>");
});
var getHtml = function(id,nickname){
	$("#student").val(nickname);
	$("#stu_id").val(id);
}

var deleteImgfw = function(id,url){
	$("#"+id).remove();
	var s=$("#fw").val();
	s = s.replace(","+url,"");
	s = s.replace(url,"");
	$("#fw").val(s);
}


var addtuif = function(){
	var id = $("#id").val();
	var stu_id = $("#stu_id").val();
	var student = $("#student").val();
	var tuifei_date = $("#tuifei_date").val();
	var course_type = $("#course_type").val();
	var money = $("#money").val();
	var beizhu = $("#beizhu").val();
	var jz_word = $("#all_words").val();
	var tea_word = $("#fw").val();
	
	if(stu_id==""){
		infopad.err("请选择下拉框选择学生，不能手动输入!");
		return;
	}
	if(tuifei_date==""){
		infopad.err("请选择申请退费日期!");
		return;
	}
	if(money==""){
		infopad.err("退费金额不能为空!");
		return;
	}
	
	$.post("${contextPath}/index/addtuifei.json", {
			"id":id,
			"stu_id":stu_id,
			"student":student,
			"tuifei_date":tuifei_date,
			"course_type":course_type,
			"money":money,
			"beizhu":beizhu,
			"tea_word":tea_word,
			"jz_word":jz_word
		}, function(ms) {
		    var msg = ms.msg;
		    if(msg!=null && msg=="1"){
				infopad.msg("操作成功！");
				window.location.href="${contextPath}/index/tuifeiindex.htm";
		    }else if(msg=="0"){
		    	infopad.err("已审核，不可编辑！");
		    }else if(msg=="2"){
		    	infopad.err("缴费时间过期，不可添加。当周缴费信息只能在当周填写！");
		    }else{
		    	infopad.err("操作失败，请联系管理员！");
		    }
			
	});
};

var submitTuif=function(){
	var id = $("#id").val();
	var stu_id = $("#stu_id").val();
	var student = $("#student").val();
	var tuifei_date = $("#tuifei_date").val();
	var course_type = $("#course_type").val();
	var money = $("#money").val();
	var beizhu = $("#beizhu").val();
	var jz_word = $("#all_words").val();
	var tea_word = $("#fw").val();
	var state = $("#state").val();
	
	if(stu_id==""||money==""||tuifei_date==""){
		infopad.err("信息不完整，不能进行审核操作!");
		return;
	}
	
	$.post("${contextPath}/index/addtuifei.json", {
		"id":id,
		"stu_id":stu_id,
		"student":student,
		"tuifei_date":tuifei_date,
		"course_type":course_type,
		"money":money,
		"beizhu":beizhu,
		"tea_word":tea_word,
		"jz_word":jz_word,
		"state":state
	}, function(ms) {
	    var msg = ms.msg;
	    if(msg!=null && msg=="1"){
			infopad.msg("操作成功！");
			window.location.href="${contextPath}/index/tuifeiindex.htm";
	    }else{
	    	infopad.err("操作失败，请联系管理员！");
	    }
		
});
	
	
};
</script>
</head>
<input type="hidden" id="stu_id" value="<#if tuf??>${tuf.stu_id}</#if>">
<input type="hidden" id="id" value="<#if tuf??>${tuf.id}</#if>">
<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>咨询师业务管理</li>
			<li>&gt;</li>
			<li class="current">退费学员明细 </li>
			<li></li>
		</ul>
	</div>
	<div id="container">
	
		<table id="infotable">
			<tr>
				<th>选择学生:</th>
				<td style="text-align:left; padding-left:10px; line-height:20px;">
				<input type="text" id="student" value="<#if tuf??>${tuf.stu_name}</#if>" class="input"><span style="font-size:10px; margin-left:5px; color:#b04b87;">*<font color="red">
				1.输入准确的学生姓名，在下来框选择，系统设置无法手动录入2.下拉框中如无缴费学员姓名，咨询老师填写学员信息后方可选择</font></span>
                        <div class="SEARCH_hide" style="display: none;" id="SearchHide1">
                             <div class="SEARCH_hideL">
                             </div>
                        </div>  
			 
				</td>
			</tr>
			<tr>
				<th>申请退费日期：</th>
				<td style="height:20px;">
					<input type="text" id="tuifei_date" rel="DATE::Y-m-d" value="<#if tuf??>${tuf.tuifei_date}</#if>" size="15" maxlength="15" readonly="readonly" class="DatePicker_Icon">
					<span style="font-size:20px; margin-left:5px; color:#b04b87;">*</span>
				</td>
			</tr>
			<tr>
				<th>退费类型：</th>
				<td style="text-align:left; padding-left:10px;">
                    	<select id="course_type">
							<option value="定金">定金</option>
						</select>
                        <span style="font-size:20px; margin-left:5px; color:#b04b87;">*</span>
                  </td>
			</tr>
			<tr>
				<th>退费金额：</th>
				<td style="text-align:left; padding-left:10px;">
                   		<input style="width:150px;" id="money" type="text" value="<#if tuf??>${tuf.money}</#if>" onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9.]/g,'')" value="" class="input w300">
                        <span style="font-size:20px; margin-left:5px; color:#b04b87;">*</span>
				</td>
			</tr>
			<tr>
				<th>备注：</th>
                <td>
					<textArea id="beizhu" style="width:500px;height:150px;"><#if tuf??>${tuf.beizhu}</#if></textArea>
				</td>
			</tr>
			
			<tr>
				<th>学员退费情况说明表（老师版）：<br/>(单击图片可删除)</th>
				<td>
					<ul class="imglist">
					<div id="imagesfw" style="float: left;">
						<#if tuf?? && tuf.tea_word?? && tuf.tea_word!="">
							<#list tuf.tea_word?split(",") as imgurl>
								<#if imgurl_index !=0>
								<li id="${imgurl?replace('http://120.55.241.58/','')?substring(25,30)}" onclick="deleteImgfw('${imgurl?replace('http://120.55.241.58/','')?substring(25,30)}','${imgurl}')" style="float:left;list-style-type: none;line-height:180px;*font-size:157px;"><img rel="800:485" width="180" height="109.125" src="http://120.55.241.58/${imgurl}"></li>
								</#if>
							</#list>
						</#if>
					</div>
					<a class="file_box" style="list-style-type: none;float: left;display: block; width:180px; height:180px; overflow: hidden; border: 1px solid #EBEBEB; background: none repeat scroll 0 0 #F3F3F3; color: #999999; cursor: pointer; text-align: center; margin-left:10px; ">
                    <em style="background:url(${staticServer}/img/add_newpic.png) 0 0; display: inline-block; width:180px; height:180px; overflow: hidden;line-height: 20em; vertical-align: middle;">
                    <input type="file" id="uploadfw" style="display: block;width:180px; height:180px;opacity: 0; filter:alpha(opacity=0); "></em>
                    </a>
                    <label class="zt_widthlabel" style=" font-size:9px; float:left; visibility:hidden;">文件：</label>
                    <input type="text" id="fw" value="<#if tuf??>${tuf.tea_word}</#if>" style=" width:100px; height:10px; float:left;visibility:hidden;" class="input w180" value="">
					</ul>
				</td>
			</tr>
			<tr>
				<th>学员退费情况说明表（家长版）：<br/>(单击图片可删除)</th>
				<td>
					<ul class="imglist">
					<div id="images" style="float: left;">
						<#if tuf?? && tuf.jz_word?? && tuf.jz_word!="">
							<#list tuf.jz_word?split(",") as imgurl>
								<#if imgurl_index !=0>
								<li id="${imgurl?replace('http://120.55.241.58/','')?substring(25,30)}" onclick="deleteImg('${imgurl?replace('http://120.55.241.58/','')?substring(25,30)}','${imgurl}')" style="float:left;list-style-type: none;line-height:180px;*font-size:157px;"><img rel="800:485" width="180" height="109.125" src="http://120.55.241.58/${imgurl}"></li>
								</#if>
							</#list>
						</#if>
					</div>
					<a class="file_box" style="list-style-type: none;float: left;display: block; width:180px; height:180px; overflow: hidden; border: 1px solid #EBEBEB; background: none repeat scroll 0 0 #F3F3F3; color: #999999; cursor: pointer; text-align: center; margin-left:10px; ">
                    <em style="background:url(${staticServer}/img/add_newpic.png) 0 0; display: inline-block; width:180px; height:180px; overflow: hidden;line-height: 20em; vertical-align: middle;">
                    <input type="file" id="upload" style="display: block;width:180px; height:180px;opacity: 0; filter:alpha(opacity=0); "></em>
                    </a>
                    <label class="zt_widthlabel" style=" font-size:9px; float:left; visibility:hidden;">文件：</label>
                    <input type="text" id="all_words" value="<#if tuf??>${tuf.jz_word}</#if>" style=" width:100px; height:10px; float:left;visibility:hidden;" class="input w180" value="">
					</ul>
				</td>
			</tr>
			<#if tuf??>
			<tr>
               	<th>审核进度：</th>
               	<td colspan="2" style="text-align:left; padding-left:10px;">
               		<select id="state">
               			<option value="">请选择</option>
               			<option value="0">未审核</option>
               			<option value="1">待提交</option>
               			<option value="2">待整理</option>
               			<option value="3">待调查</option>
               			<option value="4">待审核</option>
               			<option value="5">待打款</option>
               			<option value="6">已退款</option>
               		</select>
               	</td>
             </tr>
            </#if>
		</table>
		
		<div id="controlbar">
			&nbsp;&nbsp;&nbsp; 
			<#if tuf??><input align="center" type="button" class="submit" onclick="submitTuif()" value="确定" /></#if>
			<input align="center" type="button" class="submit" onclick="<#if tuf??>window.history.go(-1)<#else>addtuif()</#if>" value="<#if tuf??>返回列表<#else>保存</#if>" />
		</div>
	</div>


</body>
</html>
